<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>搜索地址</title>
    <!-- 1、创建地图 -->
    <script type="text/javascript">
        window._AMapSecurityConfig = {
          securityJsCode:"ec8990c1cac6e2f42866a4f908a19989",
        }
      </script>
      <script type="text/javascript"
      src="https://webapi.amap.com/maps?v=2.0&key=1d8c4c24f36ffedf82812d42f9835ac9"></script>
      <script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.15&key=您申请的key值&plugin=AMap.ToolBar,AMap.Driving"></script> 
      
      <style>
        body,html,#container{
            width: 100%;
            height: 100%;
        }
        #panel {
            position: absolute;
            background-color: white;
            max-height: 90%;
            overflow-y: auto;
            top: 10px;
            right: 10px;
            width: 280px;
        }
      </style>
</head>
<body>
    <div id="container"></div>
    <div id="panel"></div>
    <script>
        var map =new AMap.Map('container',{
            center:[116.39, 39.9],
            zoom:10,
        })
        // 引入插件
        AMap.plugin('AMap.PlaceSearch',function()
        {
            const placeSearch=new AMap.PlaceSearch({
            pageSize:5,//单页结果条数
            pageIndex:1, //页码
            city:"010",//兴趣点城市
            citylimit:true,
            map:map,
            panel:"panel",
            autoFitView:true
        })
            placeSearch.search('北京大学');    
        })
        // 使用插件关键字进行搜索并查看结果
        
    </script>
</body>
</html>